import request from '@/utils/request'
import { exportMethod } from '@/utils/utils'
import { CHECC_API_CMS } from '@/constants/proxy'
import * as proxy from '@/constants/proxy'

const getProjectList = (params: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/xmzx/szxmlxps/projectApplication/getLeaderExamineList`,
    params
  )
}
const saveProjectChange = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/update`, params)
}
const submitProjectChange = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/change-project/insert`, params)
}
const insertProject = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/insert`, params)
}
const updateProject = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/update`, params)
}
const delBatchProject = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/delBatch`, params)
}
const openProjectStatus = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/openStatus`, params)
}
const closeProjectStatus = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/projectManagement/closeStatus`, params)
}
//导出
const exportProjectList = (data: any) => {
  const params = {
    method: 'post',
    url: CHECC_API_CMS + '/xmzx/szxmlxps/projectApplication/expertLeaderExamine',
    data: data,
    fileName: '领导班子会审表格',
  }
  return exportMethod(params)
}
//导出
const exportProjectList1 = (data: any,name) => {
  const params = {
    method: 'post',
    url: CHECC_API_CMS + '/xmzx/szxmlxps/projectApplication/expertLeaderExamine',
    data: data,
    fileName: name,
  }
  return exportMethod(params)
}
//导出 --批准立项
const exportProjectListApproval = (data: any) => {
  const params = {
    method: 'post',
    url: CHECC_API_CMS + '/xmzx/szxmlxps/projectApplication/expertProjectApproval',
    data: data,
    fileName: '批准立项表格',
  }
  return exportMethod(params)
}
//导出 --批准立项
const exportApproval = (data: any,name) => {
  const params = {
    method: 'post',
    url: CHECC_API_CMS + '/xmzx/szxmlxps/projectApplication/expertProjectApproval',
    data: data,
    fileName: name,
  }
  return exportMethod(params)
}
//表格列表 --领导班子会审
// const getChangeList = (params: any = {}) => {
//   return request.post(
//     CHECC_API_CMS + `/xmzx/szxmlxps/projectApplication/getLeaderExamineList`,
//     params
//   )
// }
//表格列表 --批准立项
// const getChangeListApproval = (params: any = {}) => {
//   return request.post(
//     CHECC_API_CMS + `/xmzx/szxmlxps/projectApplication/getProjectApprovalList`,
//     params
//   )
// }
//审批
const examineChange = (params: any = {}) => {
  return request.post(CHECC_API_CMS + `/xmzx/szxmlxps/projectApplication/comfirmExpert`, params)
}

export {
  exportProjectList1,
  getProjectList,
  saveProjectChange,
  submitProjectChange,
  insertProject,
  updateProject,
  delBatchProject,
  openProjectStatus,
  closeProjectStatus,
  exportProjectList,
  // getChangeList,
  examineChange,
  // getChangeListApproval,
  exportProjectListApproval,
  exportApproval,
}

export function getChangeList(params: any) {
  return request({
      url: proxy.CHECC_API_CMS + '/xmzx/szxmlxps/projectApplication/getLeaderExamineList',
      method: 'post',
      params,
  })
}
export function getChangeListApproval(params: any) {
  return request({
      url: proxy.CHECC_API_CMS + '/xmzx/szxmlxps/projectApplication/getProjectApprovalList',
      method: 'post',
      params,
  })
}
